package myTest;

import java.math.BigDecimal;
import java.util.*;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

public class GsonTest {

	public static void main(String[] args) {
		String[] testString = {"1234567,200000410002,invest000001,测试六,130424198006229868,200000,quark00001",
				"1234567,200000410002,invest000002,安春锋,130184198901254517,200000,quark00001",
				"1234567,200000410002,invest000003,测试二,220521198210267165,200000,quark00001",
				"1234567,200000410002,invest000004,测试三,520523198812218946,200000,quark00001",
				"1234567,200000410002,invest000005,测试四,370832198911185865,281100,quark00001",
				"1234567,200000560003,invest000006,测试六,130424198006229868,200000,quark00001",
				"1234567,200000560003,invest000007,安春锋,130184198901254517,200000,quark00001",
				"1234567,200000560003,invest000008,测试二,220521198210267165,200000,quark00001",
				"1234567,200000560003,invest000009,测试三,520523198812218946,200000,quark00001",
				"1234567,200000560003,invest000010,测试四,370832198911185865,100000,quark00001",
				"1234567,200000560003,invest000011,测试五,652325199210128668,346900,quark00001"};
		List<Map<String, Object>> parmList = new ArrayList<Map<String,Object>>();
		for(String string :testString){
			Map<String, Object> map = new HashMap<String, Object>();
			String[] sss = string.split(",");
			map.put("cifname", sss[3]);
			map.put("idNum", sss[4]);
			map.put("amount",Double.parseDouble(sss[5]));
			parmList.add(map);
		}
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("lenderList", parmList);
		map.put("raiseFundNo", "1234567");
		map.put("count", "8");
		String json = new Gson().toJson(map);
		Map<String, String> ssMap = new HashMap<String, String>();
		ssMap = new Gson().fromJson(json, new TypeToken<HashMap<String,Object>>(){}.getType());
		System.out.println(ssMap);
		System.out.println(GsonTest.class.getName());
		System.out.println(System.currentTimeMillis());
	}
}
